package router

import (
	"github.com/gin-gonic/gin"
	"mxshop_api/goods-web/api/goods"
	"mxshop_api/user-web/middlewares"
)

func InitGoodsRouter(router *gin.RouterGroup) {

	router.GET("", goods.List)                                                   //商品列表
	router.POST("", middlewares.JWTAuth(), middlewares.IsAdminAuth(), goods.New) //改接口需要管理员权限
	router.GET("/:id", goods.Detail)
	router.DELETE("/:id", middlewares.JWTAuth(), middlewares.IsAdminAuth(), goods.Delete)
	router.GET("/:id/stocks", goods.Stocks)
	router.PATCH("/:id", middlewares.JWTAuth(), middlewares.IsAdminAuth(), goods.UpdateStatus)
	router.PUT("/:id", middlewares.JWTAuth(), middlewares.IsAdminAuth(), goods.Update)
}
